package two_xia.ex9.Demo03;

class NonTerminalExpression implements Expression {
    private Expression exp1;
    private Expression exp2;
    private String operator;

    public NonTerminalExpression(Expression exp1, Expression exp2, String operator) {
        this.exp1 = exp1;
        this.exp2 = exp2;
        this.operator = operator;
    }

    public void interpret(String context) {
        // 伪结果输出
        System.out.println("NonTerminalExpression: " + operator);
        exp1.interpret(context);
        exp2.interpret(context);
    }
}